package com.one.monitoring.utils;

import lombok.extern.slf4j.Slf4j;
import redis.clients.jedis.Jedis;

/**
 * @author lxh
 * @description 描述
 * @time 2023/11/17 15:39
 **/
@Slf4j
public class RedisTestUtils {

    public static Integer testRedis(){
        try {
            Jedis jedis = new Jedis("16.162.198.48", 6379);
            jedis.auth("dTi64O28qT");
            String ping = jedis.ping();
            jedis.close();
            if (ping.equalsIgnoreCase("PONG")){
                log.info("redis连接成功！");
                return 1;
            }
        }catch (Exception e){
            log.info("redis连接异常:{}",e.getMessage());
        }

        return 2;
    }
    public static void main(String[] args) {
        Integer integer = testRedis();
        System.out.println(integer);
    }
}
